/**
 * judgeDeviceType ： 判断设备是pc还是移动
 * @return boolean: true-mobile   false-pc
 * 
*/
function judgeDeviceType() {
  let sUserAgent = navigator.userAgent.toLowerCase();
  let bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
  let bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
  let bIsMidp = sUserAgent.match(/midp/i) == "midp";
  let bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
  let bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
  let bIsAndroid = sUserAgent.match(/android/i) == "android";
  let bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
  let bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
    return true
  } else {
    return false
  }
}

/**
 * 监控页面的高度的变化处理
 * @params number number：viewHeight（浏览器视口高度） viewResult（系统可用内容高度）
 * 
 */
let viewHeight = 0
let viewResult = 0
let viewObject = {
  viewResult: 0,
  isMobile: judgeDeviceType(),
}
if(!judgeDeviceType()){
  viewHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  viewResult =  viewHeight - 140; // 130px 不会产生竖向滚动条
  viewObject.viewResult = viewResult;
}

// 返回浏览器可用视口高度
export  default viewObject;

